package com.aruba.flowapplyapplication

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.lifecycleScope
import com.aruba.flowapplyapplication.common.LocalEventBus
import com.aruba.flowapplyapplication.databinding.FragmentTimeBinding
import kotlinx.coroutines.flow.collect

class TimeFragment : Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val binding = DataBindingUtil.inflate<FragmentTimeBinding>(
            inflater,
            R.layout.fragment_time,
            container,
            false
        )

        lifecycleScope.launchWhenCreated {
            LocalEventBus.event.collect {
                binding.textView3.text = it.timestamp.toString()
            }
        }

        return binding.root
    }
}